Assert redundant incremental check#156599
Conversation
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
I think we can clarify this change with a comment or by outright inlining that function. Not sure what to pick tho. |
|
Also that check is covered by tests, so I making it unconditionally panic would trigger following incremental tests failures:
|
|
I think we could change it to debug_assert and check if perf is affected. |
|
@rustbot reroll |
Making the existing helper function assert seems like a hazard if any other code starts calling it, so I think it's clearer to inline and remove the function. After inlining I think we can also get rid of the |
So to incrementally execute
tcx.ensure_done().query()we first do query graph coloring to determine if nothing has changed and maybe color our query green. In that case forensure_okwe skip further execution and return. However forensure_donewe do this check:rust/compiler/rustc_query_impl/src/execution.rs
Lines 601 to 608 in 7c3c88f
Which in turn looks up a serialized query value:
rust/compiler/rustc_middle/src/query/on_disk_cache.rs
Lines 338 to 343 in 7c3c88f
However, we only serialize query values if the pure (I've checked) function
will_cache_on_disk_for_key_fnfrom above returns true:rust/compiler/rustc_query_impl/src/plumbing.rs
Lines 95 to 99 in 7c3c88f
As such
loadable_from_diskshould be able to simply check iftcx.query_system.on_disk_cacheis loaded and assume query value is present, assuming thatwill_cache_on_disk_for_key_fnreturned true.